Desktop/Copy of GPS_TRACE/SRC/status.c

Go to the documentation of this file.
00001 #include <inttypes.h>
00002 #include <avr\pgmspace.h>
00003 #include "status.h"
00004 #include "lcd.h"
00005 #include "RS232.h"
00006 #include "init.h"
00007 #include "led.h"
00008 #include "GSMParser.h"
00009 
00010 int getFixstate ()
00011 {
00012         return fixstate;
00013 }
00014 
00015 void setFixstate (char c)
00016 {
00017         if (c=='0')
00018         {
00019                 fixstate = 0;
00020         }
00021         if (c=='1')
00022         {
00023                 fixstate = 1;
00024         }
00025 }
00026 
00027 void showFixstate()
00028 {
00029         if (getFixstate()==1)
00030         {
00031                 lcd_gotoxy(0,2);
00032         lcd_puts("GPS-Fix: Yes      ");
00033         }
00034         if (getFixstate()==0)
00035         {
00036                 lcd_gotoxy(0,2);
00037         lcd_puts("GPS-Fix: No     ");
00038         }
00039 }
00040 
00041 
00042 void showLatitudeFormatted()
00043 {
00044         lcd_gotoxy(0,1);
00045         lcd_puts(getLatitudeFormatted());
00046 }
00047 
00048 
00049 void showLongitudeFormatted()
00050 {
00051         lcd_gotoxy(0,3);
00052         lcd_puts(getLongitudeFormatted());
00053 }
00054 
00055 void setEW_indicator (char c)
00056 {
00057         EWindicator=c;
00058 }
00059 
00060 void setNS_indicator (char c)
00061 {
00062         NSindicator=c;
00063 }
00064 
00065 char getNS_indicator ()
00066 {
00067         return NSindicator;
00068 }
00069 
00070 char getEW_indicator()
00071 {
00072         return EWindicator;
00073 }
00074 
00075 char*  getLatitude()
00076 {
00077 return Latitude;
00078 }
00079 
00080 void  setLatitude(char *s)
00081 {
00082          memcpy(Latitude,s,sizeof(Latitude)-1); 
00083 }
00084 
00085 
00086 char*  getLongitude()
00087 {
00088 return Longitude;
00089 }
00090 
00091 void  setLongitude(char *s)
00092 {
00093          memcpy(Longitude,s,sizeof(Longitude)-1); 
00094 }
00095 
00096 void FormatLongitude()
00097 {
00098         LongitudeFormatted[0] = EWindicator;
00099         LongitudeFormatted[1] = ' ';
00100         LongitudeFormatted[2] = Longitude[0];
00101         LongitudeFormatted[3] = Longitude[1];
00102         LongitudeFormatted[4] = Longitude[2];
00103         LongitudeFormatted[5] = ' ';
00104         LongitudeFormatted[6] = Longitude[3];
00105         LongitudeFormatted[7] = Longitude[4];
00106         LongitudeFormatted[8] = Longitude[5];
00107         LongitudeFormatted[9] = Longitude[6];
00108         LongitudeFormatted[10] = Longitude[7];
00109         LongitudeFormatted[11] = Longitude[8];
00110         LongitudeFormatted[12] = Longitude[9];
00111         LongitudeFormatted[13] = Longitude[10];
00112 }
00113 
00114 void FormatLatitude()
00115 {
00116         LatitudeFormatted[0] = NSindicator;
00117         LatitudeFormatted[1] = ' ';
00118         LatitudeFormatted[2] = Latitude[0];
00119         LatitudeFormatted[3] = Latitude[1];
00120         LatitudeFormatted[4] = ' ';
00121         LatitudeFormatted[5] = Latitude[2];
00122         LatitudeFormatted[6] = Latitude[3];
00123         LatitudeFormatted[7] = Latitude[4];
00124         LatitudeFormatted[8] = Latitude[5];
00125         LatitudeFormatted[9] = Latitude[6];
00126         LatitudeFormatted[10] = Latitude[7];
00127         LatitudeFormatted[11] = Latitude[8];
00128         LatitudeFormatted[12] = Latitude[9];
00129 }
00130 
00131 char*  getLatitudeFormatted()
00132 {
00133 return LatitudeFormatted ;
00134 }
00135 
00136 char*  getLongitudeFormatted()
00137 {
00138 return LongitudeFormatted;
00139 }
00140 
00141 
00142 void ReportPosition()
00143 {
00144         led_yellow_off();
00145         uart0_puts("AT+CMGS="); //on the place of xxxx place phonenumber !
00146         uart0_putc('0');
00147                         int i = 10;
00148                                         for (; i < 19; i++)
00149                                         {
00150                                                 uart0_putc(GSM_COMMAND[i]);
00151                                         }
00152     uart0_putc('\r');
00153         delay_ms(1000);
00154         uart0_puts("GPS Position: ");
00155         uart0_puts(getLongitudeFormatted());
00156         uart0_putc(' ');
00157         uart0_puts(getLatitudeFormatted());
00158         uart0_putc(' ');
00159         if (getFixstate())
00160         {
00161                 uart0_puts("Fix: Yes");
00162         }
00163         else
00164         {
00165                 uart0_puts("Fix: No");
00166         }
00167         uart0_puts("\x1a");
00168 
00169 }
00170 
00171 
00172 

Generated on Fri Aug 17 13:50:54 2007 for GPS TRACE by  doxygen 1.5.3